// API配置文件
export const API_CONFIG = {
    // 基础URL - 根据环境切换
    BASE_URL: process.env.NODE_ENV === 'development' ?
        'https://api.mqgl921.com'
        // 'http://192.168.0.106:8080'
        // 'http://113.45.38.92/api'
        // 'http://localhost:8080' // 测试环境
        :
        'https://api.mqgl921.com', // 生产环境

    // 超时时间
    TIMEOUT: 10000,

    // API端点
    ENDPOINTS: {
        // 认证相关（原项目）
        AUTH: {
            LOGIN: '/auth/login',
            LOGOUT: '/auth/logout',
            TENANT_LIST: '/auth/tenant/list',
            SMS_CODE: '/resource/sms/code',
            PIC_CODE: '/auth/code',
            REAL_NAME_AUTH: '/busi/personal'
        },
        // 用户相关（原项目）
        USER: {
            INFO: '/system/user/profile',
            UPDATE: '/user/update'
        },
        // 系统相关（原项目）
        SYSTEM: {
            DICT_DATA: '/system/dict/data/list',
            OSS_UPLOAD: '/resource/oss/upload',
            OSS_DETAIL: '/resource/oss/listByIds/',
            LANGUAGE_PACK: '/user/locale',
            UPDATE_BACKEND_MLocale: '/user/update-locale'
        },
        // 虫控相关（原项目）
        PEST_CONTROL: {
            USER_AUTH: '/busi/personal', // 用户认证（包含个人和企业认证）
            TASK_STAT: '/cus/order/stat', // 客户端订单统计
            COMPANY_LIST: '/customer/corp-relation/list-corps', // 公司列表

            ORDER_LIST: '/cus/order/list', // 需求列表
            ORDER_CREATE: '/busi/order', // 创建需求
            ORDER_EDIT: '/busi/order', // 编辑需求
            ORDER_DELETE: '/busi/order/', // 删除需求{orderId}DELETE
            ORDER_TERMINATE: '/busi/order/terminate/', // 终止需求{orderId}POST
            ORDER_DETAIL: '/busi/order/', // 需求详情

            ORDER_BID_LIST: '/customer/orderBid/list/', // 竞价列表{orderId}GET
            ORDER_BID_SELECT: '/customer/orderBid/select/', // 选择竞价{bidId}POST
            ORDER_TRACK_CREATE: '/cus/order/change-status', // 创建需求跟踪POST
            CUS_MESSAGE_LIST: '/customer/order-message/list', // 消息列表
            CUS_MESSAGE_DETAIL: '/customer/order-message/detail/', // 消息详情{messageId}GET
            CUS_MESSAGE_READ: '/customer/order-message/message/read/', // 消息已读{messageId}POST

            ORDER_REVIEW_CREATE: '/customer/orderReview', // 创建需求评价POST
            ORDER_REVIEW_LIST: '/customer/orderReview/list', // 获取客户需求评价列表GET
            ORDER_REVIEW_DETAIL: '/customer/orderReview/', // 获取客户需求评价详情{reviewId}GET
        },
        // 账单相关（原项目）
        BILL: {
            LIST: '/busi/workerBill/list' // 账单列表
        },

        // 农场业务（Farming-game.md）
        FARM: {
            // 用户
            USER_INFO: '/user/', // GET 获取用户信息（header: x-token）
            LOGIN: '/user/login', // POST 登录 { address, sign }
            LOGOUT: '/user/out-login', // POST 退出登录
            INVITATION_CODE: '/user/invitation_code', // POST 填写邀请码
            UPLOAD_AVATAR: '/user/upload_avatar', // POST multipart file
            NICK_NAME: '/user/nick_name', // POST { userId, nickName }
            GET_AVATAR: '/user/get_avatar', // GET /user/get_avatar/{filename}
            NEWBIE_GIFT: '/user/newbie', // GET 新手礼包
            RECEIVE_NEWBIE_GIFT: '/user/get-newbie/', // POST /user/get-newbie/{id} 领取新手礼包
            FRIEND_LIST: '/user/friend-list', // GET 获取好友列表
            FRIEND_LAND_LIST: '/user/friend-land-list/', // GET 获取好友土地列表{id}
            ORDER_DEPOSIT: '/user/order-deposit', // POST 生成充值订单 { amount }
            ORDER_WITHDRAW: '/user/order-withdraw', // POST 生成提现订单 { applyAmount }

            // 公告
            ARTICLE_LIST: '/user/article_list', // GET ?type=0|1&page&limit
            ARTICLE_DETAIL: '/user/article_detail/', // GET /user/article_detail/{id}

            // 土地相关
            LAND_LIST: '/user/land', // GET 获取土地信息列表
            LAND_SEEDING: '/user/land/seeding', // POST 播种操作 { landId, seedId }
            LAND_HARVEST: '/user/land/win', // POST 收获果实 { landId }
            LAND_OPERATE_LIST: '/user/land/operate_list', // GET 获取土地操作信息
            LAND_OPERATE: '/user/land/operate', // POST 道具对土地操作 { landId, type, whId, itemId }

            // 商店与仓库
            STORE_SEED: '/user/store/seed', // GET ?type&page&limit
            STORE_MATERIAL: '/user/store/material', // GET ?type&page&limit
            BUY_SEED: '/user/store/pay-seed', // POST { seedId, num }
            BUY_MATERIAL: '/user/store/pay-material', // POST { materialId, num }
            STORE_ITEM: '/user/store/item', // GET ?type&page&limit
            BUY_ITEM: '/user/store/item/buy', // POST { itemId, num }
            KNAPSACK: '/user/knapsack', // GET 获取背包列表 ?type&page&limit
            PRODUCT: '/user/product', // GET 用户仓库内容
            PAY_HARVEST: '/user/pay-harvest', // POST 出售收获的果实 { num, seedId }
            PAY_HARVEST_LOG: '/user/pay-harvest-log', // GET 获取果实出售记录
            UPGRADE_STOREHOUSE: '/user/warehouse-upgrade', // POST 升级仓库
            IMAGE: '/user/image', // GET ?resource
            LAND_LOG: '/user/log-land', // GET 获取土地操作日志
            STOREHOUSE_LOG: '/user/log-warehouse', // GET 获取仓库操作日志
            STORE_LOG: '/user/log-shop', // GET 获取商店操作日志
            CROP_LOG: '/user/pay-harvest-log', // GET 获取作物出售操作日志
            RAIDERS: '/user/raiders', // GET 获取Raiders列表
            WITHDRAW_RECORD: '/user/log-usdt', // GET 获取提现记录
            SYSTEM_CONFIG: '/user/get-config-list', // GET 获取系统配置列表
            UPGRADE_MATERIAL: '/user/warehouse-upgrade-materials' // GET 获取升级材料配置
        }
    }
}

// 请求状态码
export const STATUS_CODE = {
    SUCCESS: 200,
    UNAUTHORIZED: 401,
    FORBIDDEN: 403,
    NOT_FOUND: 404,
    SERVER_ERROR: 500
}

// 业务状态码
export const BUSINESS_CODE = {
    SUCCESS: 200,
    FAIL: 500,
    UNAUTHORIZED: 401,
    FORBIDDEN: 403
}